/*
 * @lc app=leetcode.cn id=27 lang=typescript
 *
 * [27] 移除元素
 */

// @lc code=start
function removeElement(nums: number[], val: number): number {
    let c = 0;
    for (let index = 0; index < nums.length; index++) {
        const element = nums[index];
        if (element !== val) {
            nums[c] = element;
            c++;
        }
    }
    return c;
}
// @lc code=end
